package com.dsh.storeManagement.controller;
import com.dsh.model.Result;
import com.dsh.storeManagement.entity.Brand;
import com.dsh.storeManagement.service.BrandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 品牌(Brand)表控制层
 *
 * @author makejava
 * @since 2022-05-05 18:12:24
 */
@Api(tags = "品牌管理")
@RestController
@RequestMapping("brand")
public class BrandController {
    /**
     * 服务对象
     */
    @Resource
    private BrandService brandService;

    /**
     * 通过主键查询单条数据
     *
     * @return 单条数据
     */
//    @PostMapping("insert")
//    @ApiOperation("增加品牌")
//   public Result insert(Brand brand){
//       Brand insert = brandService.insert(brand);
//       return Result.success(insert,"");
//   }
//    @PostMapping("update")
//    @ApiOperation("修改品牌")
//   public Result update(@RequestBody Brand brand){
//        int update = brandService.update(brand);
//        return Result.success(update,"");
//   }
    @ApiOperation("根据查看品牌")
    @PostMapping("updateById")
    public Result select(@RequestBody Brand brand){
         this.brandService.updateById(brand);
        return Result.success("");
    }
    @ApiOperation("查看品牌")
    @GetMapping("select")
    public Result select(){
        Brand select = brandService.select();
        return Result.success(select,"");
    }

}